package com.itheima.controller;

import com.itheima.pojo.Brand;
import com.itheima.pojo.PageBean;
import com.itheima.pojo.ProductQuery;
import com.itheima.pojo.Result;
import com.itheima.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@RestController
@RequestMapping
public class ProductController {

    @Autowired
    private ProductService productService;
    @GetMapping("/products")
    public Result getPage(ProductQuery productQuery) {
        PageBean bean = productService.getPage(productQuery);
        return Result.success(bean);
    }

    @GetMapping("/brands/list")
    public Result getBrandList(){
        List<Brand> list = productService.getBrandList();
        return Result.success(list);
    }

}
